<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'app-api',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'api\controllers',
    'bootstrap' => ['log'],
    'language' => 'zh-CN',
    'modules' => [
        'v1' => [
            'class' => 'api\modules\v1\Module',
        ],
        'changyue' => [
            'class' => 'api\modules\changyue\Module',//上海常悦接口
        ],
        'chongchong51' => [
            'class' => 'api\modules\chongchong51\Module',//51充充网
        ],
        'lianzhuo' => [
            'class' => 'api\modules\lianzhuo\Module',//广州联卓
        ],
    ],
    'components' => [
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => false, // API change to false  
            'enableSession' => false,  // API ++ 
            'loginUrl' => null // API ++  
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'authManager' => [
            'class' => 'yii\rbac\DbManager', // or use 'yii\rbac\PhpManager'
        ],

        
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            // 'rules' => [
            // '<controller:\w+>/<action:\w+>‘=>‘<controller>/<action>',
            // ],
            'rules' => [
            [
            'class' => 'yii\rest\UrlRule',
            'controller' => ['v1/site','lianzhuo/site']
            ],
            ]
        ],
        'request' => [
            'parsers' => [
                'application/json' => 'yii\web\JsonParser',
                'text/json' => 'yii\web\JsonParser',
             ],
        ],
        
    ],
    

    'params' => $params,
];
